/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ultrasoft.farmasoft.domain;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Administrador
 */
@Entity
@Table(name = "typecomposition")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Typecomposition.findAll", query = "SELECT t FROM Typecomposition t"),
    @NamedQuery(name = "Typecomposition.findByTypeCompositionId", query = "SELECT t FROM Typecomposition t WHERE t.typeCompositionId = :typeCompositionId"),
    @NamedQuery(name = "Typecomposition.findByName", query = "SELECT t FROM Typecomposition t WHERE t.name = :name")})
public class Typecomposition implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "typeCompositionId")
    private Integer typeCompositionId;
    @Basic(optional = false)
    @Column(name = "name")
    private String name;
    @OneToMany(mappedBy = "typeCompositionId")
    private Collection<Composition> compositionCollection;

    public Typecomposition() {
    }

    public Typecomposition(Integer typeCompositionId) {
        this.typeCompositionId = typeCompositionId;
    }

    public Typecomposition(Integer typeCompositionId, String name) {
        this.typeCompositionId = typeCompositionId;
        this.name = name;
    }

    public Integer getTypeCompositionId() {
        return typeCompositionId;
    }

    public void setTypeCompositionId(Integer typeCompositionId) {
        this.typeCompositionId = typeCompositionId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @XmlTransient
    public Collection<Composition> getCompositionCollection() {
        return compositionCollection;
    }

    public void setCompositionCollection(Collection<Composition> compositionCollection) {
        this.compositionCollection = compositionCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (typeCompositionId != null ? typeCompositionId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Typecomposition)) {
            return false;
        }
        Typecomposition other = (Typecomposition) object;
        if ((this.typeCompositionId == null && other.typeCompositionId != null) || (this.typeCompositionId != null && !this.typeCompositionId.equals(other.typeCompositionId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ultrasoft.farmasoft.domain.Typecomposition[ typeCompositionId=" + typeCompositionId + " ]";
    }
    
}
